package net.sinodata.smartframework.exception;

import net.sinodata.smartframework.common.IErrorCode;

/**
 * Description: 自定义异常
 * 
 * @author: yinliangyun
 * @date: 2021-5-18
 */
public class BusinessException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	/** 返回码 */
	private long code;

	/** 返回信息 */
	private String message;

	/** 返回数据 */
	private Object data;

	public BusinessException() {

	}
	
	public BusinessException(long code) {
		this.code = code;
	}

	public BusinessException(long code, String message) {
		this.code = code;
		this.message = message;
	}

	public BusinessException(long code, String message, Object data) {
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public BusinessException(IErrorCode error) {
		this.code = error.getCode();
		this.message = error.getMessage();
	}
	
	public BusinessException(IErrorCode error, String message) {
		this.code = error.getCode();
		this.message = message;
	}

	public BusinessException(IErrorCode error, Object data) {
		this.code = error.getCode();
		this.message = error.getMessage();
		this.data = data;
	}

	public long getCode() {
		return code;
	}

	public void setCode(long code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
}
